'''
*猜拳游戏
*
'''
import random

li_range = {"石头": "👊", "剪子": "✌", "布": "🖐"}
key_list = [i for i in li_range.keys()]
print("猜拳小游戏，ctrl+D退出程序,输入石头、剪子、布开始游戏")
option_res = [("我赢了😃😃😃", ["石头", "剪子"]), ("我赢了😃😃😃", ["布", "石头"]), ("我赢了😃😃😃", ["剪子", "布"]), ("机器胜😭😭😭", ["剪子", "石头"]),
              ("机器胜😭😭😭", ["石头", "布"]),
              ("机器胜😭😭😭", ["布", "剪子"])]


def show_option(user_option, windows_option):
    print(f"我出 {li_range[user_option]}")
    print(f'机器出 {li_range[windows_option]}')


def is_winner(user_option, windows_option):
    temp = [user_option, windows_option]
    if temp[0] == temp[1]:
        show_option(temp[0], temp[1])
        return "双方平局"
    else:
        res_info = [i[0] for i in option_res if temp == i[1]]
        show_option(temp[0], temp[1])
        return res_info[0]


while True:
    user_option = input("请出拳:")
    windows_option = random.choice(key_list)
    if user_option in li_range.keys():
        print(is_winner(user_option, windows_option))
    else:
        print("出拳失败！")
